import Dx from "../../../qbasics/abstract/Dx.js"
/**
 * 直接从root 缓存里面加载数据，解决同步编程问题
 */
export default  class SyncJsLoad{

    run(name,obj,value,type) {
        let res;
        let root = qguan("root")
                let data1 = root.findCacheData(name )
                if(!data1){
                   throw  new Error(name +"模块，没有缓存，请先缓存数据，然后再使用")
                }

                    let dx = new Dx();
                    dx.loadData(data1)
                    let aopFactory = qguan("aopFactory")
                    let code=  dx.searchFile(value);
                    if(code){
                        let txt=  code.rxToTxt()
                        let resObj = aopFactory.syncCreateCodeObj(name,value, txt)
                        return resObj ;
                    }

                    return ;
    }
}